﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ecommerce
{
    public partial class Item : Form
    {
        public Item()
        {
            InitializeComponent();
        }

        

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void txtItemID_TextChanged(object sender,  CancelEventArgs e1)
        {
            string str = null;
                if (txtItemID.Text.Length == 0) {
                    str = "Please Enter ItemID";
                    e1.Cancel = true;
                }
                errorProvider1.SetError((Control)sender, str);
        }

        private void txtName_TextChanged(object sender,  CancelEventArgs e1)
        {
            string str = null;
            if (txtName.Text.Length == 0) {
                str = "Please Enter Your Name";
                e1.Cancel = true;
                
            }
            errorProvider1.SetError((Control)sender, str);
        }

        private void txtURL_TextChanged(object sender,  CancelEventArgs e1)
        {
            string str = null;
            if (txtName.Text.Length == 0)
            {
                str = "Please Enter Your Name";
                e1.Cancel = true;

            }
            errorProvider1.SetError((Control)sender, str);
        }

        private void txtPrices_TextChanged(object sender,  CancelEventArgs e1)
        {
            string str = null;
            if (txtName.Text.Length == 0)
            {
                str = "Please Enter Your Name";
                e1.Cancel = true;

            }
            errorProvider1.SetError((Control)sender, str);
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            this.txtItemID.Validating += new CancelEventHandler(this.txtItemID_TextChanged);
            this.txtName.Validating += new CancelEventHandler(this.txtName_TextChanged);
            this.txtURL.Validating += new CancelEventHandler(this.txtURL_TextChanged);
            this.txtPrices.Validating += new CancelEventHandler(this.txtPrices_TextChanged);
        }
    }
}
